package com.xthh._struct;

import android.graphics.Bitmap;
import android.graphics.Color;

import androidx.annotation.NonNull;


import com.xthh._enum.HH_EnumDeviceColorType;

import org.jetbrains.annotations.NotNull;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class HH_T_DeviceModel implements Cloneable, Serializable {

    private HH_EnumDeviceColorType deviceColorType;// 黑白，黑白红 黑白黄
    private String picPath;
    private List<HH_T_LayerInfo> listLayerInfo = new ArrayList<>();
    private int currentLayerIndex; //
    private int w;
    private int h;
    private String modelID;
    private String modelName;
    private Bitmap bkgBitmap;
    private int  bkgColor_r;
    private int  bkgColor_g;
    private int  bkgColor_b;
    private boolean isSingleColor;//是不是单色的图片
    private String modelType;
    private String nameChinese;
    private String nameEnglish;
    private String fileUrl;
    private Long fileSize;




    public int getCurrentLayerIndex() {
        return currentLayerIndex;
    }

    public void setCurrentLayerIndex(int currentLayerIndex) {
        this.currentLayerIndex = currentLayerIndex;
    }

    public HH_T_DeviceModel(HH_EnumDeviceColorType deviceColorType,
                         String modelName,
                         String modelType,
                         String nameChinese,
                         String nameEnglish,
                         int w, int h,
                         String fileUrl,
                         String picPath,
                         Long fileSize) {
        this.deviceColorType = deviceColorType;
        this.modelName = modelName;
        this.modelType = modelType;
        this.nameChinese = nameChinese;
        this.nameEnglish = nameEnglish;
        this.w = w;
        this.h = h;
        this.fileUrl = fileUrl;
        this.picPath = picPath;
        this.fileSize = fileSize;
    }


    public HH_T_DeviceModel(HH_EnumDeviceColorType deviceColorType, int w, int h, String modelID, String modelName) {
        this.deviceColorType = deviceColorType;
        this.w = w;
        this.h = h;
        this.modelID = modelID;
        this.modelName = modelName;
    }

    public boolean isSingleColor() {
        return isSingleColor;
    }

    public void setSingleColor(boolean singleColor) {
        isSingleColor = singleColor;
    }

    public void setBkgColor(int r, int g, int b){
        bkgColor_r = r;
        bkgColor_g = g;
        bkgColor_b = b;
    }

    public int getBkgColor_r() {
        return bkgColor_r;
    }

    public int getBkgColor(){
        return Color.rgb(bkgColor_r,bkgColor_g,bkgColor_b);
    }

    public HH_T_RGB getBkgColorT(){
        return new HH_T_RGB(bkgColor_r,bkgColor_g,bkgColor_b);
    }

    public void setBkgColor_r(int bkgColor_r) {
        this.bkgColor_r = bkgColor_r;
    }

    public int getBkgColor_g() {
        return bkgColor_g;
    }

    public void setBkgColor_g(int bkgColor_g) {
        this.bkgColor_g = bkgColor_g;
    }

    public int getBkgColor_b() {
        return bkgColor_b;
    }

    public void setBkgColor_b(int bkgColor_b) {
        this.bkgColor_b = bkgColor_b;
    }

    public Bitmap getBkgBitmap() {
        return bkgBitmap;
    }

    public void setBkgBitmap(Bitmap bkgBitmap) {
        this.bkgBitmap = bkgBitmap;
    }

    public void setBkgNull() {
        this.bkgBitmap = null;
    }

    public String getModelName() {
        return modelName;
    }

    public void setModelName(String modelName) {
        this.modelName = modelName;
    }

    public HH_EnumDeviceColorType getDeviceColorType() {
        return deviceColorType;
    }

    public void setDeviceColorType(HH_EnumDeviceColorType deviceColorType) {
        this.deviceColorType = deviceColorType;
    }

    public HH_T_DeviceModel() {
    }

    public String getModelID() {
        return modelID;
    }

    public void setModelID(String modelID) {
        this.modelID = modelID;
    }

    public void setWH(int w, int h){
        this.w = w;
        this.h = h;
    }

    public int getW() {
        return w;
    }

    public void setW(int w) {
        this.w = w;
    }

    public int getH() {
        return h;
    }

    public void setH(int h) {
        this.h = h;
    }

    public String getPicPath() {
        return picPath;
    }

    public void setPicPath(String picPath) {
        this.picPath = picPath;
    }

    public List<HH_T_LayerInfo> getListLayerInfo() {
        return listLayerInfo;
    }

    public void setListLayerInfo(List<HH_T_LayerInfo> listLayerInfo) {
        this.listLayerInfo = listLayerInfo;
    }

    public void removeLayerInfo(){
        this.listLayerInfo = new ArrayList<>();
    }

    public void removeCurrentLayerInfo(int i){
        if (i >= 0 && i < this.listLayerInfo.size())
            listLayerInfo.remove(i);
    }

    public void addListLayerInfo(HH_T_LayerInfo tl){
        this.listLayerInfo.add(tl);
    }

    public String getModelType() {
        return modelType;
    }

    public void setModelType(String modelType) {
        this.modelType = modelType;
    }

    public String getNameChinese() {
        return nameChinese;
    }

    public void setNameChinese(String nameChinese) {
        this.nameChinese = nameChinese;
    }

    public String getNameEnglish() {
        return nameEnglish;
    }

    public void setNameEnglish(String nameEnglish) {
        this.nameEnglish = nameEnglish;
    }

    public String getFileUrl() {
        return fileUrl;
    }

    public void setFileUrl(String fileUrl) {
        this.fileUrl = fileUrl;
    }

    public Long getFileSize() {
        return fileSize;
    }

    public void setFileSize(Long fileSize) {
        this.fileSize = fileSize;
    }

    @NonNull
    @NotNull
    @Override
    public HH_T_DeviceModel clone()  {
        try {
            return (HH_T_DeviceModel) super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();

        }
        return null;
    }

    public void setWH(HH_T_ModelSize modelSize) {
        this.w = modelSize.getW();
        this.h = modelSize.getH();
    }
}
